public class Duck extends Animal implements Terrestrial{
   private  int  LegNum;
    public Duck() {
    }

    public Duck(String name) {
        super(name);

    }

    public Duck(String name, int legNum) {
        super(name);
        LegNum = legNum;
    }

    public void setLegNum(int legNum) {
        if (legNum == 2) {
            LegNum = legNum;
        }
        else {
            throw new DuckException("错误信息！鸭子只有两条腿");
        }
    }

    public int getLegNum() {
        return LegNum;
    }

    public void shout() {
        System.out.println("鸭子嘎嘎嘎的叫。。。");
    }


}
